<?php
namespace Admin\Controller;
use Think\Controller;
class LoginController extends Controller {
    public function index(){
        echo "login";
        $this->display();
    }

    public function checkData()
    {	
    	//var_dump($_POST);exit;
    	if ($res = D('user')->checkLogin(I('post.nickname'),I('post.password'))){

    		$_SESSION['aid']=current($res)['id'];
    		$_SESSION['nickname']=current($res)['nickname'];	
    		$_SESSION['face']=current($res)['face'];

    	    	$arr = array(
	    			'error'=>0,
	    			'info'=>'登陆成功',
	    		);
	    		echo json_encode($arr);
	    		exit;     	
    	   }else{
	    		$arr = array(
	    			'error'=>1,
	    			'info'=>'用户名或密码错误',
	    		);
	    		echo json_encode($arr);
	    		exit;
	    }    	     

    }



}